/**
 * 
 */
package net.miranti.client;

import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.inject.client.AbstractGinModule;
import com.google.gwt.inject.client.GinModules;
import com.google.gwt.inject.client.Ginjector;
import com.google.inject.Provider;
import com.google.inject.Singleton;

public class AppModule extends AbstractGinModule {
	@Override
	protected void configure() {
		bind(HandlerManager.class)
		.toProvider(HandlerManagerProvider.class)
		.in(Singleton.class);
	}
	
	public static class HandlerManagerProvider 
	implements Provider<HandlerManager> {
		private static final HandlerManager eventBus = new HandlerManager(null); 
		
		@Override
		public HandlerManager get() {
			return eventBus; 
		}
	}
	
	@GinModules(AppModule.class)
	public interface Injector extends Ginjector{
		HandlerManager eventBus();		
	}
}